import { Callout } from '@theguild/components'

# Migration from GraphQL Import

GraphQL Import was an NPM package that allows you to import and export definitions using `#import`
syntax in `.graphql` files. So this package has been moved under GraphQL Tools monorepo. It is
really easy to migrate. You need two different packages `@graphql-tools/load` and
`@graphql-tools/graphql-file-loader`.

## Before

```ts
import { join } from 'node:path'
import { importSchema } from 'graphql-import'
import { makeExecutableSchema } from 'graphql-tools'

const typeDefs = importSchema(join(__dirname, 'schema.graphql'))

const resolvers = {
  Query: {
    // ...
  }
}
const schema = makeExecutableSchema({ typeDefs, resolvers })
```

## After

```ts
import { join } from 'node:path'
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'
import { loadSchemaSync } from '@graphql-tools/load'
import { addResolversToSchema } from '@graphql-tools/schema'

const schema = loadSchemaSync(join(__dirname, 'schema.graphql'), {
  loaders: [new GraphQLFileLoader()]
})

const resolvers = {
  Query: {
    // ...
  }
}

const schemaWithResolvers = addResolversToSchema({ schema, resolvers })
```

<Callout>
  You can learn more about those new packages in [Schema Loading](/docs/schema-loading) section.
</Callout>
